<?php
/*
 * @Author: CHINAKAIYUAN<sunkaiyuan@namenode.cn>
 * @Date: 2022-02-04 16:53:56
 * @LastEditTime: 2023-08-28 14:20:28
 * @LastEditors: 孙开源 && sunkaiyuan@namenode.cn
 * @Description: 加料单
 */

namespace App\Http\Services\Pro;


use App\Http\Services\Service;
use App\Repositories\ProEmployeeProRepository;

/**
 * @property ProEmployeeProRepository $repository 
 */
class EmployeeProService extends Service
    {

    public function boot(ProEmployeeProRepository $repository)
        {
        $this->repository = $repository;
        }

    public function list()
        {
        // DB::enableQueryLog();
        $data = $this->repository->condition(request())->orderBy("billdate", "desc")->where("quantity", ">", 0)->getGrid();
        // dd(DB::getQueryLog());
        return $data;
        }

    protected function save()
        {
        $request = request();

        $this->repository->autosave($request->toArray());
        }
    protected function delete()
        {
        return $this->repository->whereIn("id", $this->getRequestIds())->get()->filter(function ($model)
            {
            $model->delete();
            });
        }
    }